<?php

namespace app\common;

class BigWhite
{
    public function tmcl($array){
        if(count($array)>10){
            $n = 10;
        }else{
            $n = count($array);
        }
        $str = "";
        for($i=0;$i<$n;$i++){
            $m = count($array) - $i - 1;
            $str .= $array[$m] . " ";
        }
        return $str;
    }

    public function GetTm($z){
        if($z>9){
            return strval($z);
        }else{
            return "0".intval($z);
        }
    }

//    public function GetBj($need){
//
//
//        $wy = file_get_contents("http://222.187.232.201:8887/kj/action.php?token=9b&type=text&name=bj28");
//
//        $number = explode("<br/>",$wy);
//
//        $reArray = [];
//
//        for($x=0; $x<=$need;$x++){
//
//            if($x == 0){
//                $qq = 3;
//            }else{
//                $qq = 0;
//            }
//
//            $jgfg=array();
//            $jgfg=explode("+",substr ($number[$x],$qq+53,5));
//
//
//            $array = [
//                'issue' => substr ($number[$x],$qq+6,7),
//                'time' => substr ($number[$x],$qq+18,19),
//                'c1' => $jgfg[0],
//                'c2' => $jgfg[1],
//                'c3' => $jgfg[2],
//                'c4' => $jgfg[0]+$jgfg[1]+$jgfg[2],
//                'kj' => $jgfg[0]." + ".$jgfg[1]." + ".$jgfg[2]." = ".$this->GetTm($jgfg[0]+$jgfg[1]+$jgfg[2])
//            ];
//
//            $reArray[$x]=$array;
//            if($need>400){
//                if(substr ($number[$x],$qq+30,5)=="09:05"){
//                    $reArray['theIssue'] = $x;
//                    break;
//                }
//            }
//        }
//        return $reArray;
//    }

    public function GetTw(){
        $wy = file_get_contents("http://api.my9b.com/api.php?t=tw28");//http://222.187.232.201:8887/pk/tw28.php
        $reArray = json_decode($wy,true);
        return $reArray;
    }
    public function GetAz(){
        $wy = file_get_contents("http://api.my9b.com/api.php?t=az28");//http://222.187.232.201:8887/pk/tw28.php
        $reArray = json_decode($wy,true);
        return $reArray;
    }
    function GetPC(){
        $wy = file_get_contents("http://api.my9b.com/api.php?t=pc28");
        $reArray = json_decode($wy,true);
        return $reArray;
    }
    function GetJnd(){
        $wy=file_get_contents('http://api.my9b.com/api.php?t=jnd28');
        $reArray = json_decode($wy,true);
        return $reArray;
    }
    public function GetPcTime($sj){
        if(date("H")<9){
            $djs=strtotime(date("Y-m-d H:i:s",strtotime("+33000 seconds",strtotime($sj))))-time();
        } else{
            $djs=strtotime(date("Y-m-d H:i:s",strtotime("+300 seconds",strtotime($sj))))-time();
        }
        return $djs;
    }

    public function GetJndTime($sj){
        $djs=strtotime(date("Y-m-d H:i:s",strtotime("+210 seconds",strtotime($sj))))-time();
        return $djs;
    }
    public function GetDx($z){
        $z=intval($z);
        if($z>13){
            $dx2="大";
        }else{
            $dx2="小";
        }
        return $dx2;
    }
    //返回级大小
    public  function GetJdx($z){
        if($z<6){
            return "极小";
        }
        if($z>21){
            return "极大";
        }
        return GetDx($z);

    }
    //返回单双
    public  function GetDs($z){
        if($z%2==0){
            $ds2="双";
        }else{
            $ds2="单";
        }
        return $ds2;
    }
    //反组合
    public  function Getfzh($zh){
        if($zh=="大双"){return "小单";}
        if($zh=="大单"){return "小双";}
        if($zh=="小单"){return "大双";}
        if($zh=="小双"){return "大单";}
    }
    //返回组合
    public  function GetZh($z){
        return $this->GetDx($z).$this->GetDs($z);
    }
    //返回三余
    public function Get3y($z) {
        if($z==0 or $z==3 or $z==6 or $z==9 or $z==12 or $z==15 or $z==18 or $z==21 or $z==24 or $z==27){
            return "0";
        }
        if($z==1 or $z==4 or $z==7 or $z==10 or $z==13 or $z==16 or $z==19 or $z==22 or $z==25){
            return "1";
        }
        if($z==2 or $z==5 or $z==8 or $z==11 or $z==14 or $z==17 or $z==20 or $z==23 or $z==26){
            return "2";
        }
        return $z%3;
    }
    //返回四余
    public function Get4y($z) {
        if($z==0 or $z==4 or $z==8 or $z==12 or $z==16 or $z==20 or $z==24){
            return "0";
        }
        if($z==1 or $z==5 or $z==9 or $z==13 or $z==17 or $z==21 or $z==25){
            return "1";
        }
        if($z==2 or $z==6 or $z==10 or $z==14 or $z==18 or $z==22 or $z==26){
            return "2";
        }
        if($z==3 or $z==7 or $z==11 or $z==15 or $z==19 or $z==23 or $z==27){
            return "3";
        }

        return $z%4;
    }
    //返回五余
    public  function Get5y($z) {
        if($z==0 or $z==5 or $z==10 or $z==15 or $z==20 or $z==25){
            return "0";
        }
        if($z==1 or $z==6 or $z==11 or $z==16 or $z==21 or $z==26){
            return "1";
        }
        if($z==2 or $z==7 or $z==12 or $z==17 or $z==22 or $z==27){
            return "2";
        }
        if($z==3 or $z==8 or $z==13 or $z==18 or $z==23){
            return "3";
        }
        if($z==4 or $z==9 or $z==14 or $z==19 or $z==24){
            return "4";
        }

        return $z%5;
    }

    //返回中边
    public function GetZb($z){
        if($z>9 and $z<18){
            return "中";
        }else {
            return "边";
        }
    }
    //返回尾数
    public function GetWs($z) {
        return substr($z,-1,1);
    }
    //返回杀组文本
    public function GetSzWb($zh){
        if($zh=="大双"){
            return "小 + 大单";
        }
        if($zh=="大单"){
            return "小 + 大双";
        }
        if($zh=="小单"){
            return "大 + 小双";
        }
        if($zh=="小双"){
            return "大 + 小单";
        }
    }
    // 解析算法
    public  function Analysis($Mark,$str){
       return explode($Mark,$str);
    }

}